/*
 * This file is subject to the terms and conditions defined in
 * file 'LICENSE.md', which is part of this source code package.
 */

package textencoding

const (
	baseSymbol       = "SymbolEncoding"
	baseZapfDingbats = "ZapfDingbatsEncoding"
)

var (
	symbol       = newSimpleMapping(baseSymbol, symbolCharToRune)
	zapfDingbats = newSimpleMapping(baseZapfDingbats, zapfDingbatsCharToRune)
)

func init() {
	RegisterSimpleEncoding(baseSymbol, NewSymbolEncoder)
	RegisterSimpleEncoding(baseZapfDingbats, NewZapfDingbatsEncoder)
}

// NewSymbolEncoder returns a SimpleEncoder that implements SymbolEncoding.
func NewSymbolEncoder() SimpleEncoder {
	return symbol.NewEncoder()
}

// NewZapfDingbatsEncoder returns a SimpleEncoder that implements ZapfDingbatsEncoding.
func NewZapfDingbatsEncoder() SimpleEncoder {
	return zapfDingbats.NewEncoder()
}

var symbolCharToRune = map[byte]rune{ // 189 entries
	0x20: ' ', 0x21: '!', 0x22: '∀', 0x23: '#',
	0x24: '∃', 0x25: '%', 0x26: '&', 0x27: '∋',
	0x28: '(', 0x29: ')', 0x2a: '∗', 0x2b: '+',
	0x2c: ',', 0x2d: '−', 0x2e: '.', 0x2f: '/',
	0x30: '0', 0x31: '1', 0x32: '2', 0x33: '3',
	0x34: '4', 0x35: '5', 0x36: '6', 0x37: '7',
	0x38: '8', 0x39: '9', 0x3a: ':', 0x3b: ';',
	0x3c: '<', 0x3d: '=', 0x3e: '>', 0x3f: '?',
	0x40: '≅', 0x41: 'Α', 0x42: 'Β', 0x43: 'Χ',
	0x44: '∆', 0x45: 'Ε', 0x46: 'Φ', 0x47: 'Γ',
	0x48: 'Η', 0x49: 'Ι', 0x4a: 'ϑ', 0x4b: 'Κ',
	0x4c: 'Λ', 0x4d: 'Μ', 0x4e: 'Ν', 0x4f: 'Ο',
	0x50: 'Π', 0x51: 'Θ', 0x52: 'Ρ', 0x53: 'Σ',
	0x54: 'Τ', 0x55: 'Υ', 0x56: 'ς', 0x57: 'Ω',
	0x58: 'Ξ', 0x59: 'Ψ', 0x5a: 'Ζ', 0x5b: '[',
	0x5c: '∴', 0x5d: ']', 0x5e: '⊥', 0x5f: '_',
	0x60: '\uf8e5', 0x61: 'α', 0x62: 'β', 0x63: 'χ',
	0x64: 'δ', 0x65: 'ε', 0x66: 'φ', 0x67: 'γ',
	0x68: 'η', 0x69: 'ι', 0x6a: 'ϕ', 0x6b: 'κ',
	0x6c: 'λ', 0x6d: 'µ', 0x6e: 'ν', 0x6f: 'ο',
	0x70: 'π', 0x71: 'θ', 0x72: 'ρ', 0x73: 'σ',
	0x74: 'τ', 0x75: 'υ', 0x76: 'ϖ', 0x77: 'ω',
	0x78: 'ξ', 0x79: 'ψ', 0x7a: 'ζ', 0x7b: '{',
	0x7c: '|', 0x7d: '}', 0x7e: '∼', 0xa0: '€',
	0xa1: 'ϒ', 0xa2: '′', 0xa3: '≤', 0xa4: '⁄',
	0xa5: '∞', 0xa6: 'ƒ', 0xa7: '♣', 0xa8: '♦',
	0xa9: '♥', 0xaa: '♠', 0xab: '↔', 0xac: '←',
	0xad: '↑', 0xae: '→', 0xaf: '↓', 0xb0: '°',
	0xb1: '±', 0xb2: '″', 0xb3: '≥', 0xb4: '×',
	0xb5: '∝', 0xb6: '∂', 0xb7: '•', 0xb8: '÷',
	0xb9: '≠', 0xba: '≡', 0xbb: '≈', 0xbc: '…',
	0xbd: '\uf8e6', 0xbe: '\uf8e7', 0xbf: '↵', 0xc0: 'ℵ',
	0xc1: 'ℑ', 0xc2: 'ℜ', 0xc3: '℘', 0xc4: '⊗',
	0xc5: '⊕', 0xc6: '∅', 0xc7: '∩', 0xc8: '∪',
	0xc9: '⊃', 0xca: '⊇', 0xcb: '⊄', 0xcc: '⊂',
	0xcd: '⊆', 0xce: '∈', 0xcf: '∉', 0xd0: '∠',
	0xd1: '∇', 0xd2: '\uf6da', 0xd3: '\uf6d9', 0xd4: '\uf6db',
	0xd5: '∏', 0xd6: '√', 0xd7: '⋅', 0xd8: '¬',
	0xd9: '∧', 0xda: '∨', 0xdb: '⇔', 0xdc: '⇐',
	0xdd: '⇑', 0xde: '⇒', 0xdf: '⇓', 0xe0: '◊',
	0xe1: '〈', 0xe2: '\uf8e8', 0xe3: '\uf8e9', 0xe4: '\uf8ea',
	0xe5: '∑', 0xe6: '\uf8eb', 0xe7: '\uf8ec', 0xe8: '\uf8ed',
	0xe9: '\uf8ee', 0xea: '\uf8ef', 0xeb: '\uf8f0', 0xec: '\uf8f1',
	0xed: '\uf8f2', 0xee: '\uf8f3', 0xef: '\uf8f4', 0xf1: '〉',
	0xf2: '∫', 0xf3: '⌠', 0xf4: '\uf8f5', 0xf5: '⌡',
	0xf6: '\uf8f6', 0xf7: '\uf8f7', 0xf8: '\uf8f8', 0xf9: '\uf8f9',
	0xfa: '\uf8fa', 0xfb: '\uf8fb', 0xfc: '\uf8fc', 0xfd: '\uf8fd',
	0xfe: '\uf8fe',
}

var zapfDingbatsCharToRune = map[byte]rune{ // 202 entries
	0x20: ' ', 0x21: '✁', 0x22: '✂', 0x23: '✃', 0x24: '✄',
	0x25: '☎', 0x26: '✆', 0x27: '✇', 0x28: '✈', 0x29: '✉',
	0x2a: '☛', 0x2b: '☞', 0x2c: '✌', 0x2d: '✍', 0x2e: '✎',
	0x2f: '✏', 0x30: '✐', 0x31: '✑', 0x32: '✒', 0x33: '✓',
	0x34: '✔', 0x35: '✕', 0x36: '✖', 0x37: '✗', 0x38: '✘',
	0x39: '✙', 0x3a: '✚', 0x3b: '✛', 0x3c: '✜', 0x3d: '✝',
	0x3e: '✞', 0x3f: '✟', 0x40: '✠', 0x41: '✡', 0x42: '✢',
	0x43: '✣', 0x44: '✤', 0x45: '✥', 0x46: '✦', 0x47: '✧',
	0x48: '★', 0x49: '✩', 0x4a: '✪', 0x4b: '✫', 0x4c: '✬',
	0x4d: '✭', 0x4e: '✮', 0x4f: '✯', 0x50: '✰', 0x51: '✱',
	0x52: '✲', 0x53: '✳', 0x54: '✴', 0x55: '✵', 0x56: '✶',
	0x57: '✷', 0x58: '✸', 0x59: '✹', 0x5a: '✺', 0x5b: '✻',
	0x5c: '✼', 0x5d: '✽', 0x5e: '✾', 0x5f: '✿', 0x60: '❀',
	0x61: '❁', 0x62: '❂', 0x63: '❃', 0x64: '❄', 0x65: '❅',
	0x66: '❆', 0x67: '❇', 0x68: '❈', 0x69: '❉', 0x6a: '❊',
	0x6b: '❋', 0x6c: '●', 0x6d: '❍', 0x6e: '■', 0x6f: '❏',
	0x70: '❐', 0x71: '❑', 0x72: '❒', 0x73: '▲', 0x74: '▼',
	0x75: '◆', 0x76: '❖', 0x77: '◗', 0x78: '❘', 0x79: '❙',
	0x7a: '❚', 0x7b: '❛', 0x7c: '❜', 0x7d: '❝', 0x7e: '❞',
	0x80: '\uf8d7', 0x81: '\uf8d8', 0x82: '\uf8d9', 0x83: '\uf8da', 0x84: '\uf8db',
	0x85: '\uf8dc', 0x86: '\uf8dd', 0x87: '\uf8de', 0x88: '\uf8df', 0x89: '\uf8e0',
	0x8a: '\uf8e1', 0x8b: '\uf8e2', 0x8c: '\uf8e3', 0x8d: '\uf8e4', 0xa1: '❡',
	0xa2: '❢', 0xa3: '❣', 0xa4: '❤', 0xa5: '❥', 0xa6: '❦',
	0xa7: '❧', 0xa8: '♣', 0xa9: '♦', 0xaa: '♥', 0xab: '♠',
	0xac: '①', 0xad: '②', 0xae: '③', 0xaf: '④', 0xb0: '⑤',
	0xb1: '⑥', 0xb2: '⑦', 0xb3: '⑧', 0xb4: '⑨', 0xb5: '⑩',
	0xb6: '❶', 0xb7: '❷', 0xb8: '❸', 0xb9: '❹', 0xba: '❺',
	0xbb: '❻', 0xbc: '❼', 0xbd: '❽', 0xbe: '❾', 0xbf: '❿',
	0xc0: '➀', 0xc1: '➁', 0xc2: '➂', 0xc3: '➃', 0xc4: '➄',
	0xc5: '➅', 0xc6: '➆', 0xc7: '➇', 0xc8: '➈', 0xc9: '➉',
	0xca: '➊', 0xcb: '➋', 0xcc: '➌', 0xcd: '➍', 0xce: '➎',
	0xcf: '➏', 0xd0: '➐', 0xd1: '➑', 0xd2: '➒', 0xd3: '➓',
	0xd4: '➔', 0xd5: '→', 0xd6: '↔', 0xd7: '↕', 0xd8: '➘',
	0xd9: '➙', 0xda: '➚', 0xdb: '➛', 0xdc: '➜', 0xdd: '➝',
	0xde: '➞', 0xdf: '➟', 0xe0: '➠', 0xe1: '➡', 0xe2: '➢',
	0xe3: '➣', 0xe4: '➤', 0xe5: '➥', 0xe6: '➦', 0xe7: '➧',
	0xe8: '➨', 0xe9: '➩', 0xea: '➪', 0xeb: '➫', 0xec: '➬',
	0xed: '➭', 0xee: '➮', 0xef: '➯', 0xf1: '➱', 0xf2: '➲',
	0xf3: '➳', 0xf4: '➴', 0xf5: '➵', 0xf6: '➶', 0xf7: '➷',
	0xf8: '➸', 0xf9: '➹', 0xfa: '➺', 0xfb: '➻', 0xfc: '➼',
	0xfd: '➽', 0xfe: '➾',
}
